package com.erp.remote.information;

import com.erp.entity.information.Position;
import com.erp.util.AjaxResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 岗位的公共接口
 */
@RequestMapping("/information/position")
public interface PositionRemote {

    @RequestMapping("/selectAllPosition")
    AjaxResult selectAllPosition();

    @RequestMapping("/selectPositionByCompanyId")
    AjaxResult selectPositionByCompanyId(@RequestParam("companyId") Integer companyId);

    @RequestMapping("/getPositionByDescription")
    AjaxResult getPositionByDescription(@RequestBody Map<String,Object> params);

    @RequestMapping("/addPosition")
    AjaxResult addPosition(@RequestBody Position position);

    @RequestMapping("/checkPositionOnly")
    AjaxResult checkPositionOnly(@RequestParam("positionCode") String positionCode);

    @RequestMapping("/updatePosition")
    AjaxResult updatePosition(@RequestBody Position position);


    /**
     * 查询在权限表中有记录的岗位列表,description为岗位名或部门名
     */
    @RequestMapping("/selectPositionHavePermission")
    AjaxResult selectPositionHavePermission(@RequestParam("companyId") Integer companyId,@RequestParam("description") String description);


    /**
     * 根据userId查询其对应的List<position>
     */
    @PostMapping("/selectPositionsByUserId")
    AjaxResult selectPositionsByUserId(@RequestBody Map<String, Object> params);


    /**
     * 根据岗位Id删除，position_permission表中的数据
     */
    @PostMapping("/deletePermissionByPositionId")
    AjaxResult deletePermissionByPositionId(@RequestBody List<Integer> positionIds);


    /**
     * 根据岗位Id去岗位权限表中查对应的权限Id列表
     */

    @PostMapping("/selectPermissionIdsByPositionId")
    AjaxResult selectPermissionIdsByPositionId(@RequestParam("positionId") Integer positionId,@RequestParam("companyId") Integer companyId);

    @PostMapping("/selectRoleStrByCompanyIdAndSlipsType")
    AjaxResult selectRoleStrByCompanyIdAndSlipsType(@RequestParam("companyId") Integer companyId,@RequestParam("slipsType") String slipsType);
}
